package meng.study.thread.executor;

import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;

public class MyCallTask implements Callable<String> {

    private CountDownLatch countDownLatch = null;
    private int num = -1;

    public MyCallTask() {
    }

    public MyCallTask(int num, CountDownLatch countDownLatch) {
        this.countDownLatch=countDownLatch;
        this.num = num;
    }

    @Override
    public String call()   {
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("执行完成一个任务，编号：" + num);
        countDownLatch.countDown();
        return "MyCallTask:" + num;
    }
}
